package com.zyh.day02.value

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object SortBy {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setAppName("mp")
      .setMaster("local[*]")
    val sc = new SparkContext(conf)

    val rdd1: RDD[(Int, String, Int)] = sc.makeRDD(List((1, "xiaohei", 18), (2, "xiaobai", 15), (3, "xiaohei", 20)))
    val rdd2: RDD[(Int, String, Int)] = rdd1.sortBy(_._3, false)
    rdd2.collect().foreach(println)

    sc.stop()
  }
}
